package designPattern.singleton;

public class DemandOnHolderSingleton {

	private static int createTimes = 0;
	private static DemandOnHolderSingleton instance;
		
	
	private static class InstanceHolder {
		
		
		private final static DemandOnHolderSingleton instance = new DemandOnHolderSingleton();
		
	}
	
	
	private DemandOnHolderSingleton() {
		
          String test="";
          for(int i = 0; i < 1000; i++){
        	  test+=i;
          }
			createTimes++;
			System.out.println(DemandOnHolderSingleton.class.getName()+" create instance:"+createTimes+" times");
	}
	
	public static DemandOnHolderSingleton getInstance()  {
		
			
			DemandOnHolderSingleton instance = InstanceHolder.instance;

			return instance;
		
	}
}
